Skip to content

fix(mcp): support MCP 1 and 2 tool exposure - #4567

Merged
marcromeyn merged 4 commits into
NVIDIA-NeMo:mainfrom
thibautbar:fix/mcp-v1-v2
Oct 27, 2026
Merged

marcromeyn merged 4 commits into
NVIDIA-NeMo:mainfrom
thibautbar:fix/mcp-v1-v2

Conversation

@thibautbar

@thibautbar thibautbar commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Support MCP Python SDK 1.x and 2.x in Gym’s automatic tool exposure, and widen the dependency constraint from mcp>=1.28.1,<2 to mcp>=1.28.1,<3.

This removes an MCP dependency conflict when installing Gym alongside recent vLLM releases: vLLM 0.30.0 and 0.31.0 require mcp>=2.0.0,<3.0.0, which cannot resolve with Gym’s previous <2 constraint.

This matters for NeMo RL integrations that install Gym and vLLM together. NeMo RL currently pins vLLM 0.29.0 and includes Gym as an editable dependency. This change removes the MCP constraint blocking an upgrade to newer vLLM releases; it does not upgrade NeMo RL’s vLLM pin or establish compatibility for the entire training stack.

Validation

Validated on dev-thibaut-2 with Python 3.13.14:

  • python -m pytest tests/unit_tests/test_mcp_auto_exposure.py responses_api_agents/osworld_agent/tests/test_dependency_policy.py -q: 68 passed with MCP 1.29.0, and 68 passed with MCP 2.3.0.
  • gym env test +entrypoint=resources_servers/ns_tools +should_validate_data=true: 20 passed; data validation passed.
  • gym env test +entrypoint=resources_servers/newton_bench +should_validate_data=true: 61 passed; data validation passed.
  • gym env test +entrypoint=responses_api_agents/hermes_agent +should_validate_data=true: 305 passed, including the previously failing MCP connection and seeded-session tool call.
  • gym env test +entrypoint=responses_api_agents/osworld_agent +should_validate_data=true: 384 passed.
  • pre-commit run --all-files: passed; private guardwords catalog unavailable, so that scan was skipped.
  • git diff --check: passed.

Full local CI-equivalent run

Executed the repository CI scripts on dev-thibaut-2, using pinned uv 0.11.29 and Python 3.13.14, starting from d9b901d0 and applying the GDPVal test fix for its rerun:

  • scripts/ci/server_tests.sh <shard> 8 for all eight shards: all 234 modules executed, with data validation. Initial JUnit reports contain 14,734 tests, 51 skipped, 8 failures and 9 errors across four modules. All four module suites passed on rerun, as detailed below.
  • scripts/ci/core_unit_tests.sh: 8,883 passed, 28 skipped and 8 failures on the initial run. Seven failures were process-supervisor timing cases; the complete unchanged file passed on rerun (51 passed). The base checkout also exhibited timing failures in this file (2 failed, 49 passed). The remaining failure was RuntimeError: Set changed size during iteration inside tqdm while running a rollout-reverification test; that exact test passed on isolated rerun.
  • The CI sandbox command, with --cov-append and the repository coverage threshold: 926 passed, 6 skipped. Combined coverage: 95.09%, satisfying the 95% gate.
  • pre-commit run --all-files and git diff --check: passed after the final change; the private guardwords scan was unavailable.

Follow-ups from the full run:

  • GDPVal's test read the MCP 1 Python attribute inputSchema. It now checks the serialized wire alias shared by MCP 1 and 2, preserving its comparison against the benchmark's actual tool definitions. Full GDPVal suite: 851 passed, 1 skipped with MCP 2.3.0; tests/test_tools.py: 10 passed with MCP 1.30.0.
  • ether0 initially could not import RDKit because this host lacked libXrender.so.1. After installing the host library: 11 passed.
  • interactive_browser initially lacked Chromium's system libraries. After installing Playwright's Chromium system dependencies: 52 passed.
  • miniSWE's seeded-session deadline test failed under the concurrent load. Its complete suite passed on rerun without code changes: 143 passed.

This was not a clean first-pass run: all observed failures have passing reruns, and the timing/tqdm failures remain worth monitoring in GitHub CI. No tests were disabled or assertions weakened.

During validation, the PR received merge 26ad1d6c, containing only the upstream module-logger change (#4748). The GDPVal fix was reapplied on top. On this final tree, global-config/MCP tests passed (286), registry/discovery tests passed (67), and pre-commit run --all-files passed. The full suite was not repeated after that logging-only merge.

Rollouts

The Hermes integration test exercised real HTTP/MCP transport and the pinned Hermes client against a deterministic local model stub. A real-model smoke rollout was not run: this checkout has no configured model endpoint or credentials. Full repository CI remains to be rerun on the updated head.

Compatibility and benchmark impact

MCP 1 remains supported, and MCP 2 becomes an allowed dependency for Gym. The pinned NeMo-Skills and Hermes clients still require MCP 1, so their isolated environments explicitly constrain mcp<2. The Hermes sandbox installer applies the same constraint and checks that its required Streamable HTTP client API imports before reusing a runtime.

OSWorld now permits cryptography, matching Gym's resolver policy and MCP 2's import requirements. NewtonBench explicitly declares its direct python-dotenv dependency instead of relying on optional transitive dependencies. These fixes address the server-suite failures observed in run 38708851719. No task, verifier, or reward definition changes are intended.

No separate issue is needed: this is a focused dependency-compatibility fix and follow-up to the PR's CI failures.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@thibautbar
thibautbar requested a review from a team as a code owner October 13, 2026 16:41
@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Oct 13, 2026
@yaoyu-33 yaoyu-33 added area:core Shared APIs, servers, telemetry, health, and registries bug Something isn't working complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer labels Oct 13, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 14, 2026
@cmunley1

Copy link
Copy Markdown
Contributor

/ok to test 2b6ff6d

@cmunley1

Copy link
Copy Markdown
Contributor

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIP

LGTM — no reliability concerns. Reviewed all four changed files and traced the affected registration, session-token enforcement, dispatch, serialization, dependency, and lifespan paths. No actionable defects found.

Static review only; tests were not executed in this environment.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 15, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 17, 2026
ananthsub
ananthsub previously approved these changes Oct 19, 2026

@ananthsub ananthsub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution!

@svcnvidia-nemo-ci svcnvidia-nemo-ci added waiting-on-customer Waiting on the original author to respond and removed waiting-on-maintainers Waiting on maintainers to respond labels Oct 19, 2026
@thibautbar
thibautbar requested a review from ananthsub October 19, 2026 19:13
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-customer Waiting on the original author to respond label Oct 19, 2026
@thibautbar

Copy link
Copy Markdown
Contributor Author

Thanks fort the review @ananthsub ! Could you authorise the CI again? Thanks!

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Oct 20, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 22, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added waiting-on-maintainers Waiting on maintainers to respond and removed waiting-on-maintainers Waiting on maintainers to respond labels Oct 23, 2026
Signed-off-by: thibautbar <t.barroyer@icloud.com>
Signed-off-by: thibautbar <t.barroyer@icloud.com>
Signed-off-by: thibautbar <t.barroyer@icloud.com>
@ananthsub

Copy link
Copy Markdown
Contributor

/ok to test 954a6f5

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 26, 2026 12:58
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Oct 26, 2026
@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Oct 26, 2026
@marcromeyn

Copy link
Copy Markdown
Contributor

/ok to test 3010e4e

@marcromeyn
marcromeyn added this pull request to the merge queue Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40527848937

Merged via the queue into NVIDIA-NeMo:main with commit b8d3dae Oct 27, 2026
79 of 86 checks passed

This branch was previously deployed

1 inactive deployment
public — 3010e4eb Deployed Oct 27, 2026 by copy-pr-bot[bot] via release / finalize / notify #7608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Shared APIs, servers, telemetry, health, and registries bug Something isn't working community-request Issue reported or requested by someone from the community complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants